<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="../js/vue.js"></script>
</head>

<body>
    <div id="root">

    </div>
</body>

</html>
<script>
    const vm = new Vue({
        el: '#root',
        data: {
            n: 1
        },
        template: `
        <div>
            <h2>当前n的值是:{{n}}</h2>
              <button @click="add">点我n+1</button>
            </div>
        `,
        methods: {
            add() {
                this.n += 1
            }
        },
        beforeCreate() {
            console.log(this)
            // debugger
        },
        created() {
            console.log('created')
        },
    })
</script>